package com.itheima.reggie.utils;

import com.itheima.reggie.domain.Employee;

public class EmpThreadLocal {
    /**
     * 创建一个ThreadLocal对象
     */
    private static final ThreadLocal<Employee> tl = new ThreadLocal<>();

    //传递一个emp对象绑定到当前线程
    public static void set(Employee employee) {
        tl.set(employee);
    }

    //从当前线程是获取绑定的emp对象
    public static Employee get() {
        return tl.get();
    }

    //从当前线程解除绑定的emp对象
    public static void remove() {
        tl.remove();
    }
}
